namespace SmartSoft.SystemForms
{
    using SmartSoft;
    using SmartSoft.Controls;
    using SmartSoft.ADP;
    using System;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.IO;
    using System.Windows.Forms;

    public class FormRegister : FormControl
    {
        private BtnControl btnCancel;
        private BtnControl btnCreate;
        private BtnControl btnSave;
        private IContainer components;
        private GBoxControl gBoxControl1;
        private bool ib_CheckIDKey = true;
        private LabelControl labelControl1;
        private LabelControl labelControl2;
        private LabelControl lblEnglishAddress;
        private LabelControl lblEnglishName;
        private LabelControl lblLocalAddress;
        private LabelControl lblLocalName;
        private LabelControl lblTaxCode;
        private DataRow oLocalCurrentRow;
        private DataTable oLocalDataTable;
        private TextControl txtEnglishAddress;
        private TextControl txtEnglishName;
        private TextControl txtLocalAddress;
        private TextControl txtLocalName;
        private TextControl txtSerial1;
        private TextControl txtSerial2;
        private TextControl txtSerial3;
        private TextControl txtSerial4;
        private TextControl txtSerial5;
        private TextControl txtTaxCode;

        public FormRegister()
        {
            this.InitializeComponent();
        }

        private void btnCancel_Click(object sender, EventArgs e)
        {
            base.Close();
        }

        private void btnCreate_Click(object sender, EventArgs e)
        {
            this.SetCompanyInfo();
        }

        private void btnSave_Click(object sender, EventArgs e)
        {
            if (this.LocalCurrentRow != null)
            {
                FolderBrowserDialog dialog = new FolderBrowserDialog();
                dialog.ShowNewFolderButton = true;
                dialog.ShowDialog();
                if (Directory.Exists(dialog.SelectedPath))
                {
                    File.WriteAllText(dialog.SelectedPath + @"\RegisteredFile.dll", this.LocalCurrentRow["RegisteredFile"].ToString());
                }
            }
        }

        protected override void Dispose(bool disposing)
        {
            if (disposing && (this.components != null))
            {
                this.components.Dispose();
            }
            base.Dispose(disposing);
        }

        private void FindCompanyInfo()
        {
            string str = this.txtSerial1.Text.Trim();
            string str2 = this.txtSerial2.Text.Trim();
            string str3 = this.txtSerial3.Text.Trim();
            string str4 = this.txtSerial4.Text.Trim();
            string str5 = this.txtSerial5.Text.Trim();
            if (!AppInstance.SoftwareDecode(0x8b, str, str2, str3, str4, str5))
            {
                MessageBox.Show("Mã số kh\x00e1ch hàng không chính xác!", AppInstance.SoftwareName, MessageBoxButtons.OK, MessageBoxIcon.Hand);
            }
            else
            {
                string key = str + "-" + str2 + "-" + str3 + "-" + str4 + "-" + str5;
                if (this.LocalDataTable.Rows.Find(key) == null)
                {
                    MessageBox.Show("Mã số kh\x00e1ch hàng không tồn tại!", AppInstance.SoftwareName, MessageBoxButtons.OK, MessageBoxIcon.Hand);
                }
                else
                {
                    this.LocalCurrentRow = this.LocalDataTable.Rows.Find(key);
                    this.txtTaxCode.Value = this.LocalCurrentRow["TaxCode"];
                    this.txtLocalName.Value = this.LocalCurrentRow["LocalName"];
                    this.txtEnglishName.Value = this.LocalCurrentRow["EnglishName"];
                    this.txtLocalAddress.Value = this.LocalCurrentRow["LocalAddress"];
                    this.txtEnglishAddress.Value = this.LocalCurrentRow["EnglishAddress"];
                    this.txtSerial1.ReadOnly = true;
                    this.txtSerial2.ReadOnly = true;
                    this.txtSerial3.ReadOnly = true;
                    this.txtSerial4.ReadOnly = true;
                    this.txtSerial5.ReadOnly = true;
                    this.txtTaxCode.ReadOnly = false;
                    this.txtLocalName.ReadOnly = false;
                    this.txtEnglishName.ReadOnly = false;
                    this.txtLocalAddress.ReadOnly = false;
                    this.txtEnglishAddress.ReadOnly = false;
                    this.txtTaxCode.Focus();
                    this.btnCreate.Enabled = true;
                    this.CheckIDKey = false;
                }
            }
        }

        private void InitializeComponent()
        {
            //ComponentResourceManager manager = new ComponentResourceManager(typeof(FormRegister));
            this.lblLocalName = new LabelControl();
            this.txtLocalName = new TextControl();
            this.lblEnglishName = new LabelControl();
            this.txtEnglishName = new TextControl();
            this.lblLocalAddress = new LabelControl();
            this.txtLocalAddress = new TextControl();
            this.lblEnglishAddress = new LabelControl();
            this.txtEnglishAddress = new TextControl();
            this.btnCancel = new BtnControl();
            this.btnCreate = new BtnControl();
            this.labelControl1 = new LabelControl();
            this.gBoxControl1 = new GBoxControl();
            this.txtSerial1 = new TextControl();
            this.txtSerial5 = new TextControl();
            this.txtSerial4 = new TextControl();
            this.txtSerial2 = new TextControl();
            this.txtSerial3 = new TextControl();
            this.labelControl2 = new LabelControl();
            this.lblTaxCode = new LabelControl();
            this.txtTaxCode = new TextControl();
            this.btnSave = new BtnControl();
            this.gBoxControl1.SuspendLayout();
            base.SuspendLayout();
            this.lblLocalName.AutoSize = true;
            this.lblLocalName.Font = new Font("Arial", 8.25f);
            this.lblLocalName.Location = new Point(12, 0x74);
            this.lblLocalName.Name = "lblLocalName";
            this.lblLocalName.Size = new Size(0x3a, 14);
            this.lblLocalName.TabIndex = 0;
            this.lblLocalName.Text = "Tên đơn vị";
            this.txtLocalName.Anchor = AnchorStyles.Right | AnchorStyles.Left | AnchorStyles.Top;
            this.txtLocalName.CheckTextSearched = false;
            this.txtLocalName.DisabledForeColor = Color.Empty;
            this.txtLocalName.Font = new Font("Arial", 8.25f);
            this.txtLocalName.Location = new Point(0x6b, 0x71);
            this.txtLocalName.Name = "txtLocalName";
            this.txtLocalName.OldValue = null;
            this.txtLocalName.ReadOnly = true;
            this.txtLocalName.Size = new Size(0x127, 20);
            this.txtLocalName.TabIndex = 2;
            this.txtLocalName.Text = "Công ty Cổ phần SSSoft";
            this.txtLocalName.Value = "Công ty Cổ phần SSSoft";
            this.lblEnglishName.AutoSize = true;
            this.lblEnglishName.Font = new Font("Arial", 8.25f);
            this.lblEnglishName.Location = new Point(12, 0x8e);
            this.lblEnglishName.Name = "lblEnglishName";
            this.lblEnglishName.Size = new Size(0x4a, 14);
            this.lblEnglishName.TabIndex = 0;
            this.lblEnglishName.Text = "Tên tiếng Anh";
            this.txtEnglishName.Anchor = AnchorStyles.Right | AnchorStyles.Left | AnchorStyles.Top;
            this.txtEnglishName.CheckTextSearched = false;
            this.txtEnglishName.DisabledForeColor = Color.Empty;
            this.txtEnglishName.Font = new Font("Arial", 8.25f);
            this.txtEnglishName.Location = new Point(0x6b, 0x8b);
            this.txtEnglishName.Name = "txtEnglishName";
            this.txtEnglishName.OldValue = null;
            this.txtEnglishName.ReadOnly = true;
            this.txtEnglishName.Size = new Size(0x127, 20);
            this.txtEnglishName.TabIndex = 3;
            this.txtEnglishName.Text = "SSSoft Joint Stock Company";
            this.txtEnglishName.Value = "SSSoft Joint Stock Company";
            this.lblLocalAddress.AutoSize = true;
            this.lblLocalAddress.Font = new Font("Arial", 8.25f);
            this.lblLocalAddress.Location = new Point(12, 0xa8);
            this.lblLocalAddress.Name = "lblLocalAddress";
            this.lblLocalAddress.Size = new Size(40, 14);
            this.lblLocalAddress.TabIndex = 0;
            this.lblLocalAddress.Text = "Địa chỉ";
            this.txtLocalAddress.Anchor = AnchorStyles.Right | AnchorStyles.Left | AnchorStyles.Top;
            this.txtLocalAddress.CheckTextSearched = false;
            this.txtLocalAddress.DisabledForeColor = Color.Empty;
            this.txtLocalAddress.Font = new Font("Arial", 8.25f);
            this.txtLocalAddress.Location = new Point(0x6b, 0xa5);
            this.txtLocalAddress.Name = "txtLocalAddress";
            this.txtLocalAddress.OldValue = null;
            this.txtLocalAddress.ReadOnly = true;
            this.txtLocalAddress.Size = new Size(0x127, 20);
            this.txtLocalAddress.TabIndex = 4;
            this.txtLocalAddress.Text = "Số 11, L\x00f4 A2, Ho\x00e0ng Cầu, Đống Đa, H\x00e0 Nội";
            this.txtLocalAddress.Value = "Số 11, L\x00f4 A2, Ho\x00e0ng Cầu, Đống Đa, H\x00e0 Nội";
            this.lblEnglishAddress.AutoSize = true;
            this.lblEnglishAddress.Font = new Font("Arial", 8.25f);
            this.lblEnglishAddress.Location = new Point(12, 0xc2);
            this.lblEnglishAddress.Name = "lblEnglishAddress";
            this.lblEnglishAddress.Size = new Size(0x59, 14);
            this.lblEnglishAddress.TabIndex = 0;
            this.lblEnglishAddress.Text = "Địa chỉ tiếng Anh";
            this.txtEnglishAddress.Anchor = AnchorStyles.Right | AnchorStyles.Left | AnchorStyles.Top;
            this.txtEnglishAddress.CheckTextSearched = false;
            this.txtEnglishAddress.DisabledForeColor = Color.Empty;
            this.txtEnglishAddress.Font = new Font("Arial", 8.25f);
            this.txtEnglishAddress.Location = new Point(0x6b, 0xbf);
            this.txtEnglishAddress.Name = "txtEnglishAddress";
            this.txtEnglishAddress.OldValue = null;
            this.txtEnglishAddress.ReadOnly = true;
            this.txtEnglishAddress.Size = new Size(0x127, 20);
            this.txtEnglishAddress.TabIndex = 5;
            this.txtEnglishAddress.Text = "No 11, Lot A2, Hoang Cau, Dong Da, Ha Noi";
            this.txtEnglishAddress.Value = "No 11, Lot A2, Hoang Cau, Dong Da, Ha Noi";
            this.btnCancel.Anchor = AnchorStyles.Right | AnchorStyles.Bottom;
            //this.btnCancel.DialogResult = DialogResult.Cancel;
            this.btnCancel.Font = new Font("Arial", 8.25f);
            this.btnCancel.Location = new Point(0x11a, 0xec);
            this.btnCancel.Name = "btnCancel";
            this.btnCancel.Size = new Size(120, 0x17);
            this.btnCancel.TabIndex = 8;
            this.btnCancel.Text = "&Thoát (Esc)";
            this.btnCancel.UseVisualStyleBackColor = true;
            this.btnCancel.Click += new EventHandler(this.btnCancel_Click);
            this.btnCreate.Anchor = AnchorStyles.Right | AnchorStyles.Bottom;
            this.btnCreate.Enabled = false;
            this.btnCreate.Font = new Font("Arial", 8.25f);
            this.btnCreate.Location = new Point(12, 0xec);
            this.btnCreate.Name = "btnCreate";
            this.btnCreate.Size = new Size(120, 0x17);
            this.btnCreate.TabIndex = 6;
            this.btnCreate.Text = "&Lưu (F3)";
            this.btnCreate.UseVisualStyleBackColor = true;
            this.btnCreate.Click += new EventHandler(this.btnCreate_Click);
            this.labelControl1.BorderStyle = BorderStyle.Fixed3D;
            this.labelControl1.Font = new Font("Arial", 8.25f);
            this.labelControl1.Location = new Point(12, 0xdf);
            this.labelControl1.Name = "labelControl1";
            this.labelControl1.Size = new Size(390, 2);
            this.labelControl1.TabIndex = 0;
            this.gBoxControl1.Controls.Add(this.txtSerial1);
            this.gBoxControl1.Controls.Add(this.txtSerial5);
            this.gBoxControl1.Controls.Add(this.txtSerial4);
            this.gBoxControl1.Controls.Add(this.txtSerial2);
            this.gBoxControl1.Controls.Add(this.txtSerial3);
            this.gBoxControl1.Font = new Font("Arial", 8.25f);
            this.gBoxControl1.Location = new Point(0x33, 12);
            this.gBoxControl1.Name = "gBoxControl1";
            this.gBoxControl1.Size = new Size(0x138, 0x33);
            this.gBoxControl1.TabIndex = 0;
            this.gBoxControl1.TabStop = false;
            this.gBoxControl1.Text = "Mã số kh\x00e1ch hàng - Customer code";
            this.txtSerial1.CharacterCasing = CharacterCasing.Upper;
            this.txtSerial1.CheckTextSearched = false;
            this.txtSerial1.DisabledForeColor = Color.Blue;
            this.txtSerial1.Font = new Font("Arial", 8.25f);
            this.txtSerial1.Location = new Point(14, 20);
            this.txtSerial1.MaxLength = 4;
            this.txtSerial1.Name = "txtSerial1";
            this.txtSerial1.OldValue = null;
            this.txtSerial1.Size = new Size(0x34, 20);
            this.txtSerial1.TabIndex = 0;
            this.txtSerial1.TextAlign = HorizontalAlignment.Center;
//            this.txtSerial1.Value = null;//manager.GetObject("txtSerial1.Value");
            this.txtSerial5.CharacterCasing = CharacterCasing.Upper;
            this.txtSerial5.CheckTextSearched = false;
            this.txtSerial5.DisabledForeColor = Color.Blue;
            this.txtSerial5.Font = new Font("Arial", 8.25f);
            this.txtSerial5.Location = new Point(0xf6, 20);
            this.txtSerial5.MaxLength = 4;
            this.txtSerial5.Name = "txtSerial5";
            this.txtSerial5.OldValue = null;
            this.txtSerial5.Size = new Size(0x34, 20);
            this.txtSerial5.TabIndex = 4;
            this.txtSerial5.TextAlign = HorizontalAlignment.Center;
//            this.txtSerial5.Value = null;//manager.GetObject("txtSerial5.Value");
            this.txtSerial4.CharacterCasing = CharacterCasing.Upper;
            this.txtSerial4.CheckTextSearched = false;
            this.txtSerial4.DisabledForeColor = Color.Blue;
            this.txtSerial4.Font = new Font("Arial", 8.25f);
            this.txtSerial4.Location = new Point(0xbc, 20);
            this.txtSerial4.MaxLength = 4;
            this.txtSerial4.Name = "txtSerial4";
            this.txtSerial4.OldValue = null;
            this.txtSerial4.Size = new Size(0x34, 20);
            this.txtSerial4.TabIndex = 3;
            this.txtSerial4.TextAlign = HorizontalAlignment.Center;
//            this.txtSerial4.Value = null;//manager.GetObject("txtSerial4.Value");
            this.txtSerial2.CharacterCasing = CharacterCasing.Upper;
            this.txtSerial2.CheckTextSearched = false;
            this.txtSerial2.DisabledForeColor = Color.Blue;
            this.txtSerial2.Font = new Font("Arial", 8.25f);
            this.txtSerial2.Location = new Point(0x48, 20);
            this.txtSerial2.MaxLength = 4;
            this.txtSerial2.Name = "txtSerial2";
            this.txtSerial2.OldValue = null;
            this.txtSerial2.Size = new Size(0x34, 20);
            this.txtSerial2.TabIndex = 1;
            this.txtSerial2.TextAlign = HorizontalAlignment.Center;
//            this.txtSerial2.Value = null;//manager.GetObject("txtSerial2.Value");
            this.txtSerial3.CharacterCasing = CharacterCasing.Upper;
            this.txtSerial3.CheckTextSearched = false;
            this.txtSerial3.DisabledForeColor = Color.Blue;
            this.txtSerial3.Font = new Font("Arial", 8.25f);
            this.txtSerial3.Location = new Point(130, 20);
            this.txtSerial3.MaxLength = 4;
            this.txtSerial3.Name = "txtSerial3";
            this.txtSerial3.OldValue = null;
            this.txtSerial3.Size = new Size(0x34, 20);
            this.txtSerial3.TabIndex = 2;
            this.txtSerial3.TextAlign = HorizontalAlignment.Center;
//            this.txtSerial3.Value = null;//manager.GetObject("txtSerial3.Value");
            this.labelControl2.BorderStyle = BorderStyle.Fixed3D;
            this.labelControl2.Font = new Font("Arial", 8.25f);
            this.labelControl2.Location = new Point(12, 0x4a);
            this.labelControl2.Name = "labelControl2";
            this.labelControl2.Size = new Size(390, 2);
            this.labelControl2.TabIndex = 10;
            this.lblTaxCode.AutoSize = true;
            this.lblTaxCode.Font = new Font("Arial", 8.25f);
            this.lblTaxCode.Location = new Point(12, 90);
            this.lblTaxCode.Name = "lblTaxCode";
            this.lblTaxCode.Size = new Size(60, 14);
            this.lblTaxCode.TabIndex = 0;
            this.lblTaxCode.Text = "Mã số thuế";
            this.txtTaxCode.Anchor = AnchorStyles.Right | AnchorStyles.Left | AnchorStyles.Top;
            this.txtTaxCode.CheckTextSearched = false;
            this.txtTaxCode.DisabledForeColor = Color.Empty;
            this.txtTaxCode.Font = new Font("Arial", 8.25f);
            this.txtTaxCode.Location = new Point(0x6b, 0x57);
            this.txtTaxCode.Name = "txtTaxCode";
            this.txtTaxCode.OldValue = null;
            this.txtTaxCode.ReadOnly = true;
            this.txtTaxCode.Size = new Size(0x127, 20);
            this.txtTaxCode.TabIndex = 1;
            this.txtTaxCode.Text = "Công ty Cổ phần SSSoft";
            this.txtTaxCode.Value = "Công ty Cổ phần SSSoft";
            this.btnSave.Anchor = AnchorStyles.Right | AnchorStyles.Bottom;
            this.btnSave.Font = new Font("Arial", 8.25f);
            this.btnSave.Location = new Point(0x93, 0xec);
            this.btnSave.Name = "btnSave";
            this.btnSave.Size = new Size(120, 0x17);
            this.btnSave.TabIndex = 7;
            this.btnSave.Text = "&Ghi tệp đăng ký";
            this.btnSave.UseVisualStyleBackColor = true;
            this.btnSave.Click += new EventHandler(this.btnSave_Click);
            base.AutoScaleDimensions = new SizeF(6f, 13f);
            base.CancelButton = this.btnCancel;
            base.ClientSize = new Size(0x19e, 0x10f);
            base.Controls.Add(this.labelControl2);
            base.Controls.Add(this.gBoxControl1);
            base.Controls.Add(this.btnCancel);
            base.Controls.Add(this.btnSave);
            base.Controls.Add(this.btnCreate);
            base.Controls.Add(this.txtEnglishAddress);
            base.Controls.Add(this.labelControl1);
            base.Controls.Add(this.lblEnglishAddress);
            base.Controls.Add(this.txtLocalAddress);
            base.Controls.Add(this.lblLocalAddress);
            base.Controls.Add(this.txtEnglishName);
            base.Controls.Add(this.lblEnglishName);
            base.Controls.Add(this.txtTaxCode);
            base.Controls.Add(this.lblTaxCode);
            base.Controls.Add(this.txtLocalName);
            base.Controls.Add(this.lblLocalName);
            //base.FormBorderStyle = FormBorderStyle.FixedSingle;
            base.MaximizeBox = false;
            base.MinimizeBox = false;
            base.Name = "FormRegister";
            this.Text = "Register";
            this.gBoxControl1.ResumeLayout(false);
            this.gBoxControl1.PerformLayout();
            base.ResumeLayout(false);
            base.PerformLayout();
        }

        private void LockCompanyInfo()
        {
            this.txtSerial1.ReadOnly = false;
            this.txtSerial2.ReadOnly = false;
            this.txtSerial3.ReadOnly = false;
            this.txtSerial4.ReadOnly = false;
            this.txtSerial5.ReadOnly = false;
            this.txtTaxCode.ReadOnly = true;
            this.txtLocalName.ReadOnly = true;
            this.txtEnglishName.ReadOnly = true;
            this.txtLocalAddress.ReadOnly = true;
            this.txtEnglishAddress.ReadOnly = true;
            this.txtSerial1.Focus();
            this.btnCreate.Enabled = false;
            this.CheckIDKey = true;
        }

        protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
        {
            switch (keyData)
            {
                case Keys.F3:
                    if (this.btnCreate.Enabled)
                    {
                        this.SetCompanyInfo();
                    }
                    break;

                case Keys.F4:
                    if (!this.CheckIDKey)
                    {
                        this.LockCompanyInfo();
                        break;
                    }
                    this.FindCompanyInfo();
                    break;
            }
            return base.ProcessCmdKey(ref msg, keyData);
        }

        private void SetCompanyInfo()
        {
            if (this.LocalCurrentRow["RegisteredFile"].Equals(DBNull.Value) || (MessageBox.Show("Thông tin đã có, muốn lưu lại không?", AppInstance.SoftwareName, MessageBoxButtons.YesNo, MessageBoxIcon.Question) != DialogResult.No))
            {
                DataTable table = new DataTable("CompanyInfo");
                DataColumn column = new DataColumn();
                column.ColumnName = "LocalName";
                column.DataType = System.Type.GetType("System.String");
                column.MaxLength = 0x80;
                DataColumn column2 = new DataColumn();
                column2.ColumnName = "EnglishName";
                column2.DataType = System.Type.GetType("System.String");
                column2.MaxLength = 0x80;
                DataColumn column3 = new DataColumn();
                column3.ColumnName = "LocalAddress";
                column3.DataType = System.Type.GetType("System.String");
                column3.MaxLength = 0x80;
                DataColumn column4 = new DataColumn();
                column4.ColumnName = "EnglishAddress";
                column4.DataType = System.Type.GetType("System.String");
                column4.MaxLength = 0x80;
                DataColumn column5 = new DataColumn();
                column5.ColumnName = "SoftwareSerialKey";
                column5.DataType = System.Type.GetType("System.String");
                column5.MaxLength = 0x80;
                table.Columns.Add(column);
                table.Columns.Add(column2);
                table.Columns.Add(column3);
                table.Columns.Add(column4);
                table.Columns.Add(column5);
                string str = this.txtSerial1.Text.Trim();
                string str2 = this.txtSerial2.Text.Trim();
                string str3 = this.txtSerial3.Text.Trim();
                string str4 = this.txtSerial4.Text.Trim();
                string str5 = this.txtSerial5.Text.Trim();
                string str6 = str + "-" + str2 + "-" + str3 + "-" + str4 + "-" + str5;
                DataRow row = table.NewRow();
                UserDataAccess access = new UserDataAccess();
                row["LocalName"] = access.Base64Encode(this.txtLocalName.Text);
                row["EnglishName"] = access.Base64Encode(this.txtEnglishName.Text);
                row["LocalAddress"] = access.Base64Encode(this.txtLocalAddress.Text);
                row["EnglishAddress"] = access.Base64Encode(this.txtEnglishAddress.Text);
                row["SoftwareSerialKey"] = access.Base64Encode(str6);
                table.Rows.Add(row);
                table.AcceptChanges();
                table.WriteXml(Application.CommonAppDataPath + "RegisteredFile.dll");
                this.LocalCurrentRow["TaxCode"] = this.txtTaxCode.Value;
                this.LocalCurrentRow["LocalName"] = this.txtLocalName.Value;
                this.LocalCurrentRow["EnglishName"] = this.txtEnglishName.Value;
                this.LocalCurrentRow["LocalAddress"] = this.txtLocalAddress.Value;
                this.LocalCurrentRow["EnglishAddress"] = this.txtEnglishAddress.Value;
                this.LocalCurrentRow["RegisteredFile"] = File.ReadAllText(Application.CommonAppDataPath + "RegisteredFile.dll");
                File.Delete(Application.CommonAppDataPath + "RegisteredFile.dll");
                this.LocalDataTable.WriteXml(@"D:\TAMNV\SSSOFT\CardNumber.xml");
            }
        }

        private bool CheckIDKey
        {
            get
            {
                return this.ib_CheckIDKey;
            }
            set
            {
                this.ib_CheckIDKey = value;
            }
        }

        private DataRow LocalCurrentRow
        {
            get
            {
                return this.oLocalCurrentRow;
            }
            set
            {
                this.oLocalCurrentRow = value;
            }
        }

        private DataTable LocalDataTable
        {
            get
            {
                if (this.oLocalDataTable == null)
                {
                    this.oLocalDataTable = new DataTable("CardNumber");
                    DataColumn column = new DataColumn();
                    column.ColumnName = "CardNumber";
                    column.DataType = System.Type.GetType("System.String");
                    column.MaxLength = 0x18;
                    DataColumn column2 = new DataColumn();
                    column2.ColumnName = "CreatedDate";
                    column2.DataType = System.Type.GetType("System.DateTime");
                    DataColumn column3 = new DataColumn();
                    column3.ColumnName = "TaxCode";
                    column3.DataType = System.Type.GetType("System.String");
                    column3.MaxLength = 0x80;
                    DataColumn column4 = new DataColumn();
                    column4.ColumnName = "LocalName";
                    column4.DataType = System.Type.GetType("System.String");
                    column4.MaxLength = 0x80;
                    DataColumn column5 = new DataColumn();
                    column5.ColumnName = "EnglishName";
                    column5.DataType = System.Type.GetType("System.String");
                    column5.MaxLength = 0x80;
                    DataColumn column6 = new DataColumn();
                    column6.ColumnName = "LocalAddress";
                    column6.DataType = System.Type.GetType("System.String");
                    column6.MaxLength = 0x80;
                    DataColumn column7 = new DataColumn();
                    column7.ColumnName = "EnglishAddress";
                    column7.DataType = System.Type.GetType("System.String");
                    column7.MaxLength = 0x80;
                    DataColumn column8 = new DataColumn();
                    column8.ColumnName = "RegisteredFile";
                    column8.DataType = System.Type.GetType("System.String");
                    this.oLocalDataTable.Columns.Add(column);
                    this.oLocalDataTable.Columns.Add(column2);
                    this.oLocalDataTable.Columns.Add(column3);
                    this.oLocalDataTable.Columns.Add(column4);
                    this.oLocalDataTable.Columns.Add(column5);
                    this.oLocalDataTable.Columns.Add(column6);
                    this.oLocalDataTable.Columns.Add(column7);
                    this.oLocalDataTable.Columns.Add(column8);
                    this.oLocalDataTable.PrimaryKey = new DataColumn[] { column };
                    if (File.Exists(@"D:\TAMNV\SSSOFT\CardNumber.xml"))
                    {
                        this.oLocalDataTable.ReadXml(@"D:\TAMNV\SSSOFT\CardNumber.xml");
                    }
                }
                return this.oLocalDataTable;
            }
        }
    }
}

